package admin

import (
	"context"
	"server/internal/model"
	"server/internal/service"

	"server/api/admin/lesson"
)

func (c *ControllerLesson) CategoryUpdate(ctx context.Context, req *lesson.CategoryUpdateReq) (res *lesson.CategoryUpdateRes, err error) {
	res = new(lesson.CategoryUpdateRes)
	res.Result, err = service.LessonCategory().UpdateByID(ctx, req.ID, model.LessonCategoryUpdateInput{
		ParentId: req.ParentId,
		Name:     req.Name,
		Code:     req.Code,
		Cover:    req.Cover,
		Remark:   req.Remark,
	})
	return
}
